package ar.edu.unlu.sistemas.p2p.business.vo;

import java.net.InetSocketAddress;
import java.util.StringTokenizer;

import ar.edu.unlu.sistemas.p2p.business.task.Result;

public class PingResultVO extends Result{
	
	private InetSocketAddress address;
	private int nFiles;
	
	public InetSocketAddress getAddress() {
		return address;
	}

	public void setAddress(InetSocketAddress address) {
		this.address = address;
	}
	
	public int getnFiles() {
		return nFiles;
	}
	
	public void setnFiles(int nFiles) {
		this.nFiles = nFiles;
	}
	
	public PingResultVO(String stringAddr, int nFiles) {
		StringTokenizer st = new StringTokenizer(stringAddr,":");
		this.address = new InetSocketAddress(st.nextToken(),Integer.parseInt(st.nextToken()));
		this.nFiles = nFiles;
	}

	public PingResultVO(InetSocketAddress addr, int nFiles) {
		this.address = addr;
		this.nFiles = nFiles;
	}
	
	public String toString() {
		return "addr: "+this.getAddress().toString()+"\nfiles: "+String.valueOf(this.getnFiles());
	}

}
